function getWidget(wids,wp) {
	console.log(wids)
	$.ajax({
		url:'http://localhost:8080/widget/render',
        dataType:'jsonp',
        //jsonp: "callback",
        jsonpCallback: "success_callback",
        data:{
            wids:wids
            wp:
        },
        success:function(result){
            console.log(result)
        } ,
        error:function(err){
        	console.log(err)
        }
    });
}

$(document).ready(function(){
    var widgets = $("[wid]")
    var wids = []
    for(var i=0;i<widgets.length;i++) {
	    //console.log($(widgets[i]).attr('wid'))
	    var wid = $(widgets[i]).attr('wid')
	    var wp = $(widgets[i]).attr('wp')
	    if (wp!=null && wp!="") {
	    	/*wp = wp.replace(/(?:\s*['"]*)?([a-zA-Z0-9]+)(?:['"]*\s*)?:/g, "'$1':");
	    	wp = "\""+wp+"\""
	    	console.log($.parseJSON(wp))
	    	console.log(2222)
	    	console.log(JSON.parse(wp))*/
	    	console.log(wp)
	    	wp =eval("\""+wp+"\"")
	    	console.log(wp.a)
	    }
	    wids.push(wid)
	}
    console.log(wids.length)
    getWidget(wids.join(','))
    //var widgets = $("[attribute='token']")
    
});